enyo.kind({
    name: "MyApps.StoresList",
    kind: enyo.VFlexBox,
    events: {
        onBack: "",
		onDetailSelect:"",
    },
    components: [    /**
     * Layout
     */
    {
        name: "pane",
        kind: "Pane",
        flex: 1,
        components: [{
            name: "golfView",
            kind: "VFlexBox",
            components: [{
                kind: "Scroller",
				className:"storeslist",
				flex: 1,
                components: [{
                    name: "list",
                    kind: "VirtualRepeater",
                    flex: 1,
                    onSetupRow: "listSetupRow",
                    components: [{
                        kind: "Item",
                        layoutKind: "HFlexLayout",
                        components: [{
                            name: "itemLabel",
                            flex: 1
                        }, {
                            name: "rowLabel"
                        }],
                        onclick: "listItemClick"
                    }]
                }, ]
            }, ]
        },        /**
         * Components definition
         */
       ]
    }, ],
    create: function(){
        this.inherited(arguments);
        this.data = [];
    },
    
    listSetupRow: function(inSender, inRow){
        var f = this.data[inRow];
        if (f) {
            this.$.itemLabel.setContent(f.shop.nom);
            return true;
        }
    },
    listItemClick: function(inSender, inEvent){
        var store = this.data[inEvent.rowIndex];
		this.doDetailSelect(store.shop.id);
    },
    
    setData: function(data){
        this.data = data;
        this.$.pane.render();
    },
    goBack: function(inSender, inEvent){
        this.$.pane.back(inEvent);
    },

});



